package com.spider.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.dbutils.QueryRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import javax.sql.DataSource;

/**
 * 常用组件
 * @author panglin
 * @date 2020/11/22 10:00
 */
@Configuration
public class GlobalConfig {

    @Resource
    private DataSource dataSource;

    @Bean
    public QueryRunner queryRunner(){
        return new QueryRunner(this.dataSource);
    }

    @Bean
    public ObjectMapper objectMapper(){
        return new ObjectMapper();
    }
}
